package com.sunrise.generico.entidade;

import java.util.Collection;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import lombok.Getter;
import lombok.Setter;

import com.sunrise.generico.entidade.iface.EntidadeManter;
import com.sunrise.generico.enums.MotivoAjusteEstoque;
import com.sunrise.generico.enums.Status;

@Entity
@Table(name = "ajuste_estoque")
public class AjusteEstoque implements EntidadeManter {

	/**
	 * 
	 */
	private static final long serialVersionUID = 6325839401309331150L;

	@Id
	@SequenceGenerator(name="pk_sequence",sequenceName="ajuste_estoque_id_seq", allocationSize=1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="pk_sequence")
	@javax.persistence.Column
	@Getter @Setter
	private Long id;
	
	@Column(name = "nome", length = 100)
	@Getter @Setter
	private String nome;
	
	@NotNull( message="{motivoAjusteObrigatorio}")
	@Enumerated
	@Getter @Setter
	private MotivoAjusteEstoque motivo;
	
	@Enumerated
	@Getter @Setter
	private Status status;
	
	
	@Column(name = "dataAjuste")
	@Getter @Setter
	private Date dataAjuste;
	
	@OneToMany
	@Getter @Setter
	private Collection<EstoqueAjustado> estoquesAjustados;
	
	@OneToMany
	@Getter @Setter
	private Collection<HistoricoAjuste> historicosAjuste;
	
	@ManyToOne
	@Getter @Setter
	private Filial filial;
	
	@OneToOne
	@Getter @Setter
	private Usuario criador;
	
	
}
